package com.life.ai.server.modules.system.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum OrderStatusEnum {
    PENDING_SHIPMENT("1","待发货"),
    PENDING_RECEIPT("2","待收货"),
    TO_BE_EVALUATED("3","待评价"),
    BE_EVALUATED("4","已评价"),
    FINISHED("5","已完成"),
    CANCEL("6","已取消");

    private final String code;
    private final String value;


    public static String getValueByCode(String code){
        for (OrderStatusEnum orderStatusEnum : OrderStatusEnum.values()) {
            if(orderStatusEnum.code.equals(code)){
                return orderStatusEnum.value;
            }
        }
        return "未知状态";
    }

    /**
     * 只有待发货的订单才可以取消
     * @param code
     * @return
     */
    public static Boolean checkStatus(String code){
        return code.equals(PENDING_SHIPMENT.code);
    }

}
